1. Field of the Invention
Embodiments of the present invention relate generally to memory flush and more specifically to memory flush applicable to multiple memory targets in a distributed shared memory system.
2. Description of the Related Art
In a shared memory system, memory flush is employed as a mechanism to inform processes that data has been completely written out to memory to ensure that subsequent read accesses of the same data by the processes will not be made while the data is being written out. A simple example of a memory flush is described below with reference to a shared memory environment illustrated in FIG. 1.
In FIG. 1, Process A issues a series of write instructions to write data to memory partitions 11-1, 11-2 of a memory unit 10 that has N partitions. The write instructions are stored in corresponding instruction queues 21-1, 21-2 of a memory controller 20, and processed in the order they were received. After the last write instruction, Process A issues a memory flush command to the memory controller 20. In response, the memory controller 20 issues flush read instructions for its memory partitions 11-1, 11-2, . . . , 11-N and stores them in the instructions queues 21-1, 21-2, . . . 21-N. A flush read instruction gets processed like a read instruction by the memory controller 20 except that a flush read does not cause data to be read from memory because a flush read includes an invalid memory address in the memory address field. When a flush read is processed, a specially tagged data, instead of data that is read from memory, is returned as the read result. The return of this specially tagged data in response to a flush read instruction following a write instruction signifies that the write to that memory partition has completed. Thus, when the flush read instructions in the instructions queues 21-1, 21-2, . . . , 21-N are processed and this specially tagged data is returned as the read result in each case, Process B is permitted to read the data in memory partitions 11-1, 11-2.
The memory flush technique described above can be applied efficiently in a homogeneous shared memory environment. However, in a heterogeneous shared memory environment or a distributed shared memory environment, the process is not as efficient because memory flushes of non-local memory partitions are much slower than memory flushes of local memory partitions. One solution would be to perform targeted memory flushes, i.e., perform a flush read of only those memory partitions that were written to, but there is significant overhead in keeping track of the memory partitions that were written to, especially in complex, distributed shared memory environments. When virtual memory is used, as often is the case, keeping track of the memory partitions that were written to becomes even more difficult. For these reasons, a memory flush technique that is efficient for use in heterogeneous shared memory environments is desirable.